package com.dongjiantong.mq.msg.aliyun;

import com.dongjiantong.common.utils.StringUtil;
import com.google.common.collect.Maps;

import java.util.Map;

/**
 * @author cao
 * @create 2017-12-25 下午6:41
 **/
public class SmsResultCode {



    /**
     * 是否成功
     */
    private boolean success;

    /**
     * 信息
     */
    private String message;


    public boolean getSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = getResult(message);
    }


    private  String getResult(String code)
    {
       String result =  resultMap().get(code);

       if(!StringUtil.isBlank(result))
       {
           return  result;
       }
       return  "其它";
    }

    private  Map<String,String> resultMap()
    {
        Map<String,String > map = Maps.newHashMap();
        map.put("OK",	"请求成功");
        map.put("isp.RAM_PERMISSION_DENY",	"RAM权限DENY");
        map.put("isv.OUT_OF_SERVICE",	"业务停机");
        map.put("isv.PRODUCT_UN_SUBSCRIPT",	"未开通云通信产品的阿里云客户");
        map.put("isv.PRODUCT_UNSUBSCRIBE",	"产品未开通");
        map.put("isv.ACCOUNT_NOT_EXISTS",	"账户不存在");
        map.put("isv.ACCOUNT_ABNORMAL",	"账户异常");
        map.put("isv.SMS_TEMPLATE_ILLEGAL",	"短信模板不合法");
        map.put("isv.SMS_SIGNATURE_ILLEGAL",	"短信签名不合法");
        map.put("isv.INVALID_PARAMETERS",	"参数异常");
        map.put("isp.SYSTEM_ERROR",	"系统错误");
        map.put("isv.MOBILE_NUMBER_ILLEGAL",	"非法手机号");
        map.put("isv.MOBILE_COUNT_OVER_LIMIT",	"手机号码数量超过限制");
        map.put("isv.TEMPLATE_MISSING_PARAMETERS",	"模板缺少变量");
        map.put("isv.BUSINESS_LIMIT_CONTROL",	"业务限流");
        map.put("isv.INVALID_JSON_PARAM",	"JSON参数不合法，只接受字符串值");
        map.put("isv.BLACK_KEY_CONTROL_LIMIT",	"黑名单管控");
        map.put("isv.PARAM_LENGTH_LIMIT",	"参数超出长度限制");
        map.put("isv.PARAM_NOT_SUPPORT_URL",	"不支持URL");
        map.put("isv.AMOUNT_NOT_ENOUGH",	"账户余额不足");
        map.put("isv.TEMPLATE_PARAMS_ILLEGAL","模板变量里包含非法关键字");
        map.put("SignatureDoesNotMatch","Signature加密错误");
        map.put("InvalidTimeStamp.Expired","时间戳错误，发出请求的时间和服务器接收到请求的时间不在15分钟内。");
        map.put("SignatureNonceUsed","唯一随机数重复");
        map.put("InvalidVersion","版本号错误");
        map.put("InvalidAction.NotFound","接口名错误");
        map.put("InvalidTooLong",	"手机号码超过1000");
        map.put("InvalidMobileEmpty",	"手机号码为空");

        return map;

    }

}
